package ws.jdbc.concurrent.driver.sqlserver.cursor.wrapper;

import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Implementation of the {@link ICursorForwardUpdate} services.
 * 
 * @author Wilson Santos, 36228 <wilson.santos@ua.pt>
 */
public class CursorForwardUpdate extends CursorForwardReadOnly implements ResultSet {

  public CursorForwardUpdate(ResultSet rs) {
    super(rs);
  }

  @Override
  public void moveToInsertRow() throws SQLException {
    synchronized (rs) {
      rs.moveToInsertRow();
    }
  }

  @Override
  public void moveToCurrentRow() throws SQLException {
    synchronized (rs) {
      rs.moveToCurrentRow();
    }
  }

  @Override
  public void cancelRowUpdates() throws SQLException {
    synchronized (rs) {
      rs.cancelRowUpdates();
    }
  }

  @Override
  public void updateDouble(int columnIndex, double x) throws SQLException {
    synchronized (rs) {
      rs.updateDouble(columnIndex, x);
    }
  }

  @Override
  public void updateDate(int columnIndex, Date x) throws SQLException {
    synchronized (rs) {
      rs.updateDate(columnIndex, x);
    }
  }

  @Override
  public void updateInt(int columnIndex, int x) throws SQLException {
    synchronized (rs) {
      rs.updateInt(columnIndex, x);
    }
  }

  @Override
  public void updateString(int columnIndex, String x) throws SQLException {
    synchronized (rs) {
      rs.updateString(columnIndex, x);
    }
  }

  @Override
  public void updateRow() throws SQLException {
    synchronized (rs) {
      rs.updateRow();
    }
  }

  @Override
  public void insertRow() throws SQLException {
    synchronized (rs) {
      rs.insertRow();
    }
  }
}
